<template>
<div>

    <!-- 轮播图区域 -->
    <mt-swipe :auto="4000">
        <mt-swipe-item v-for="item in lunbotuList" :key="lunbotuList.url">
            <a :href="item.url">
           <img :src="item.img" alt="">
           </a>
        </mt-swipe-item>

    </mt-swipe>
    <!-- 九宫格到六宫格 -->
    <ul class="mui-table-view mui-grid-view mui-grid-9">
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
            <router-link to="/news/newslist">
                <img src="../../images/menu1.png" alt="新闻资讯" srcset="">
                <div class="mui-media-body">新闻资讯</div>
            </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
             <router-link to="">
                <img src="../../images/menu2.png" alt="图片分享" srcset="">
                <div class="mui-media-body">图片分享</div>
            </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
             <router-link to="">
                <img src="../../images/menu3.png" alt="商品购买" srcset="">
                <div class="mui-media-body">商品购买</div>
            </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
             <router-link to="">
                <img src="../../images/menu4.png" alt="留言反馈" srcset="">
                <div class="mui-media-body">留言反馈</div>
            </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
             <router-link to="">
                <img src="../../images/menu5.png" alt="视频专区" srcset="">
                <div class="mui-media-body">视频专区</div>
            </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
             <router-link to="">
                <img src="../../images/menu6.png" alt="联系我们" srcset="">
                <div class="mui-media-body">联系我们</div>
            </router-link>
        </li>

    </ul>

</div>
</template>

<script>
// 导入mint-ui

import {
    Toast
} from 'mint-ui'

export default {
    data() {
        return {
            lunbotuList: [] //保存轮播图的数组
        }
    },
    methods: {
        getLunBoTu() { //获取录播图数据方法
            this.$http.get('api/getlunbo').then(res => {
                console.log(res.body);
                if (res.body.status === 0) {
                    //   成功
                    this.lunbotuList = res.body.message;

                } else {
                    //   失败
                    Toast({
                        message: '调用接口失败',
                        position: 'middle',
                        duration: 5000
                    });
                }
            });
            // this.$api.get('api/getlunbo',response => {
            //     if (response.body.status ===0) {
            //         console.log(response.body.message);//请求成功， response为成功信息参数
            //     } else {
            //         Toast('请求失败');//请求失败， response为失败信息
            //     }
            // });
        }
    },
    created() {
        this.getLunBoTu();
    },
}
</script>

<style lang="scss" scoped>
.mint-swipe {
    height: 200px;

    .mint-swipe-item {

        &:nth-child(1) {
            background: plum;
        }

        &:nth-child(2) {
            background: blueviolet;
        }

        &:nth-child(3) {
            background: bisque;
        }
    }

    img {
        width: 100%;
        height: 100%;
    }

}

.mui-grid-view.mui-grid-9 .mui-table-view-cell {
    background: #ffffff;
    border: none;

    img {
        width: 60px
    }

    .mui-media-body {
        font-size: 13px;
    }
}

.mui-grid-view.mui-grid-9 {
    background: #ffffff;
    border: none;
}
</style>
